package com.chaos.framework.model.enums;

import lombok.Getter;

/**
 * @author Jacky
 */

@Getter
public enum ResultEnum {
    //2XX 成功
    OK(200, "success"),

    //4xx 客户端错误(请求存在错误)
    BAD_REQUEST(400, "Bad Request"),
    UNAUTHORIZED(401, "Unauthorized"),
    PAYMENT_REQUIRED(402, "Payment Required"),
    FORBIDDEN(403, "Forbidden"),
    NOT_FOUND(404, "Not Found"),
    REQUEST_TIMEOUT(408, "Request Timeout"),

    TOKEN_INVALID_OR_EXPIRED(409, "Token Invalid Or Expired"),
    LOCKED(423, "Locked"),
    TOO_EARLY(425, "Too Early"),
    TOO_MANY_REQUESTS(429, "Too Many Requests"),
    UNAVAILABLE_FOR_LEGAL_REASONS(451, "Unavailable For Legal Reasons"),

    NO_CLIENT_ID(460, "No clientId"),


    //5xx 服务端错误
    INTERNAL_SERVER_ERROR(500, "Internal Server Error"),
    NOT_IMPLEMENTED(501, "Not Implemented"),
    BAD_GATEWAY(502, "Bad Gateway"),
    SERVICE_UNAVAILABLE(503, "Service Unavailable"),
    GATEWAY_TIMEOUT(504, "Gateway Timeout"),
    VERSION_NOT_SUPPORTED(505, "Version not supported"),
    INSUFFICIENT_STORAGE(507, "Insufficient Storage"),
    LOOP_DETECTED(508, "Loop Detected"),
    LIMIT_EXCEEDED(509, "Bandwidth Limit Exceeded"),

    UNKNOWN_ERROR(555, "未知错误"),

    //6xx 业务错误
    ILLEGAL_ARGUMENT(601, "参数非法"),
    INVALID_FORMAT(602, "参数格式错误"),
    METHOD_ARGUMENT_NOT_VALID(603, "参数无效"),
    ILLEGAL_CHARACTERS(604, "非法字符"),
    SQL_DUPLICATE_KEY(611, "数据重复"),
    SQL_DATA_INTEGRITY_VIOLATION(612, "数据不完整性"),
    NO_DATA(620, "数据不存在"),
    NO_USER(621, "用户不存在"),
    NO_TENANT(622, "未指定租户"),

    //100X 认证相关
    INVALID_REQUEST(1001, "请求参数无效或缺失"),
    INVALID_CLIENT(1002, "客户端认证失败"),
    INVALID_GRANT(1003, "提供的授权凭证无效"),
    UNAUTHORIZED_CLIENT(1004, "客户端没有权限使用指定的授权类型"),
    UNSUPPORTED_GRANT_TYPE(1005, "授权服务器不支持请求的授权类型"),
    INVALID_SCOPE(1006, "请求的范围无效或不支持"),
    ACCESS_DENIED(1007, "资源所有者或授权服务器拒绝了请求"),
    UNSUPPORTED_RESPONSE_TYPE(1008, "授权服务器不支持请求的响应类型"),

    //110X 用户相关
    WRONG_PASSWORD(1101, "密码错误"),
    ;


    private Integer code;

    private String defaultMsg;

    ResultEnum(Integer code, String defaultMsg) {
        this.code = code;
        this.defaultMsg = defaultMsg;
    }


}
